package ygo

const (
	MEM_SIZE=4096
)

func RAM (
	address    chan uint32,
	read_write chan bool,
	data_in    chan int32,
	data_out   chan int32 ) {

	var (
		data [MEM_SIZE]int32
		v_addr uint32
		write bool
	)
	
	for {
		v_addr = <-address;
		write = <-read_write;
		if (write) {
			data [v_addr%MEM_SIZE] =  <-data_in
		} else {
			data_out <- data [v_addr%MEM_SIZE]
		}
	}
}


